package com.yzy.soft.config;

//import org.activiti.spring.SpringAsyncExecutor;
//import org.activiti.spring.SpringProcessEngineConfiguration;
//import org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration;


/**
 * @author kingboy--KingBoyWorld@163.com
 * @date 2017/8/30 上午12:54
 * @desc Activiti的数据和事物配置.
 */
//@Configuration//声名为配置类，继承Activiti抽象配置类
public class ActivitiConfig  {
//extends AbstractProcessEngineAutoConfiguration
//    @Resource
//    DataSource activitiDataSource;//注入配置好的数据源

//    @Bean
////    @Primary
//    @ConfigurationProperties(prefix = "datasourc.activiti")
//    public DataSource activitiDataSource() {
//        return DataSourceBuilder.create().build();
//    }



    //注入spring自带的jpa属性类
//    @Autowired
//    private JpaProperties jpaProperties;

    /*
     *拿到hibernate的通用配置
     */
//    private Map<String, String> getProperties(DataSource dataSource) {
//        return jpaProperties.getHibernateProperties(dataSource);
//    }

    /*
     *配置事物管理的Bean
     */
//    @Bean("activitiTransactionManager")
//    public PlatformTransactionManager activitiTransactionManager(EntityManagerFactoryBuilder builder) {
//        return new JpaTransactionManager(activitiEntityManagerFactory(builder).getObject());
//    }

    //@Resource
//    PlatformTransactionManager activitiTransactionManager;//注入配置好的事物管理器

    //注入数据源和事务管理器
   // @Bean
//    public SpringProcessEngineConfiguration springProcessEngineConfiguration(
//            SpringAsyncExecutor springAsyncExecutor) throws IOException {
////        System.out.println("2222222222222:"+activitiDataSource);
////        System.out.println("2222222222222:"+activitiTransactionManager);
//        return this.baseSpringProcessEngineConfiguration(activitiDataSource, activitiTransactionManager, springAsyncExecutor);
//    }
}
